from marbles import Ball
import pygame as pg
import time

isBlball = False

pg.mixer.init()
sound = pg.mixer.Sound("explosion.wav")


class BlackBall(Ball.Ball):

    def __init__(self, ball, speed, radius, screen):
        Ball.Ball.__init__(self, ball, speed, radius, screen)

    def draw(self):
        Ball.Ball.draw(self, (0, 0, 0))

    def move_ball(self, paddle):
        time.sleep(0.001)
        self.ball[0] += self.speed[0]
        self.ball[1] += self.speed[1]

        # at the edge
        if self.ball[1] - self.radius == 0 or self.ball[1] + self.radius == 480:
            self.speed[1] *= -1
        if self.ball[0] + self.radius == 640 or self.ball[0] - self.radius == 0:
            self.speed[0] *= -1

        # on the paddle
        if self.ball[1] + self.radius == paddle.top and paddle.left < self.ball[0] + self.radius < paddle.right:
            sound.play()
            Ball.score -= 10
